<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <title>文件维护</title>
    <script src="../trd/jquery/jquery-2.0.2.min.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../trd/element/element.css">
<!--
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
-->
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../trd/element/fonts/element-icons.ttf" type="text/css" />
    <script type="text/javascript" src="../trd/vue/vue.js"></script>
    <script type="text/javascript" src="../trd/element/element.js"></script>
    <style>
        .cell {
            padding-right: 0px !important;
        }
        .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
            background-color: #85ce61;
        }
    </style>
</head>

<body style="background-color: rgb(255, 255, 255); box-sizing: border-box; color: rgb(51, 51, 51); display: block; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
    <div id="app" style="margin:0;height: 100%" v-cloak>
        <el-container style="    height: 100%;">

            <el-aside width="20%" >
                <el-row style="    line-height: 50px;  margin-left: 20px;">
                    <el-col :span="24">
                        <el-button size="small" type="success" @click="addLb">新增根节点</el-button>
                    </el-col>
                </el-row>
                <el-divider content-position="left"></el-divider>
                <el-row>
                    <el-tree
                            :data="lbCodeInfo"
                            :props="lbTreeProps"
                            ref="tree"
                            :highlight-current=true
                            :default-expand-all=true
                            accordion
                            node-key="lbId"
                            @node-click="handleNodeClick">
                        <span class="custom-tree-node" slot-scope="{ node, lbCodeInfo }">
                            <span>{{ node.label }}</span>
                            <span>
                                <el-button
                                     type="text"
                                     size="mini"
                                     class="small_icon"
                                     @click.stop="append(node,lbCodeInfo)">
                                    <i class="el-icon-circle-plus"></i>
                                </el-button>
                                <el-button
                                        type="text"
                                        size="mini"
                                        class="small_icon"
                                        v-show="node.pid != ''"
                                        @click.stop="update(node, lbCodeInfo)">
                                    <i class="el-icon-s-tools" style="color: #E6530B"></i>
                                </el-button>
                                <el-button
                                        type="text"
                                        size="mini"
                                        class="small_icon"
                                        v-show="node.pid != ''"
                                        @click.stop="remove(node, lbCodeInfo)">
                                    <i class="el-icon-delete-solid"></i>
                                </el-button>
                            </span>
                          </span>
                    </el-tree>
                </el-row>
            </el-aside>
            <el-container >
                <el-main>
                    <el-row>
                        <el-col :span="24">
                            <el-button type="success" size="small" @click="add">新增</el-button>
                            <el-button type="danger" size="small" @click="delBatch">删除</el-button>
                        </el-col>
                    </el-row>
                    <el-divider content-position="left"></el-divider>
                    <el-row>
                        <el-table :header-row-class-name="'table-header'" :row-class-name="'table-row'" border
                                :data="fileList"
                                ref="selectedRow"
                                style="width: 100%">
                            <el-table-column
                                    type="selection"
                                    width="55">
                            </el-table-column>
                            <el-table-column
                                    prop="fileName"
                                    label="文件名称"
                                    width="180">
                            </el-table-column>
                            <el-table-column
                                    prop="type"
                                    label="文件类型"
                                    width="180">
                                <template slot-scope="scope">
                                    <el-select v-model="scope.row.type" placeholder="请选择" :disabled="true">
                                        <el-option
                                                v-for="item in fileTypes"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value">
                                        </el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    prop="createTime"
                                    label="最后修改时间"
                                    width="180">
                            </el-table-column>
                            <el-table-column
                                    label="操作">
                                <template slot-scope="scope">
                                    <el-button size="small" @click="fix(scope.$index, scope.row)">修改</el-button>
                                    <el-button size="small" @click="del(scope.$index, scope.row)">删除</el-button>
                                    <el-button size="small" @click="query(scope.$index, scope.row)">查看</el-button>
                                    <el-button size="small" @click="download(scope.$index, scope.row)">下载</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        </template>
                    </el-row>
                </el-main>
            </el-container>
        </el-container>
        <!--新增文件分类-->
        <el-dialog :title="dialogNameByLb"
                   :visible.sync="dialogVisibleByLb"
                   width="80%">
            <el-form :model="fileLbForm"  ref="fileLbForm" label-width="150px" class="demo-ruleForm">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="类别名称" prop="lbName">
                            <el-input v-model="fileLbForm.lbName"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="类别编码" prop="lbCode">
                            <el-input v-model="fileLbForm.lbCode"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <span slot="footer" class="dialog-footer">
                 <el-button size="small" @click="resetForm('fileLbForm')">重 置</el-button>
                <el-button size="small" @click="dialogVisibleByLb = false">取 消</el-button>
                <el-button size="small" v-if="openDialogTypeByLb!=3" type="primary" @click="submitFormByLb('fileLbForm')">保 存</el-button>
            </span>
        </el-dialog>
        <!--新增文件-->
        <el-dialog
                :title="dialogName"
                :visible.sync="dialogVisible"
                width="80%">
            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="文件名称" prop="fileName">
                            <el-input v-model="ruleForm.fileName"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="文件类型" prop="type">
                            <el-select v-model="ruleForm.type" placeholder="请选择">
                                <el-option
                                        v-for="item in fileTypes"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-upload
                            class="upload-demo"
                            ref="upload"
                            :action="url"
                            :on-preview="handlePreview"
                            :on-remove="handleRemove"
                            :on-error="handleerror"
                            :file-list="fileTmp"
                            :on-change="fixChange"
                            :data="ruleForm"
                            :http-request="uploadZDY"
                            :limit=1
                            :auto-upload="false">
                        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
                        <div slot="tip" class="el-upload__tip">只能上传war/zip/doc/docx文件，且不超过500M</div>
                    </el-upload>
                </el-row>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button size="small" @click="resetForm('ruleForm')">重 置</el-button>
                <el-button size="small" @click="dialogVisible = false">取 消</el-button>
                <el-button size="small" v-if="openDialogType!=3" type="primary" @click="submitForm('ruleForm')">保 存</el-button>
            </span>
        </el-dialog>
    </div>

</body>
<script type="text/javascript" src="file.js"></script>
</html>
